<?php
class SysAccountGroupsForm extends BaseFormAdmin{
	public function configure(){
		parent::configure();
		
		/*
		 * Add properties
		 */
		$this->addName();
		$this->addType();
		
		/*
		 * Setting name of form
		 */
		$this->widgetSchema->setNameFormat('SysAccountGroups[%s]');
		$this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);
	}
	/*
	 * Name of group
	 */
	private function addName(){
		$this->setWidget('name', new sfWidgetFormInputText());
		$this->setValidator('name', new sfValidatorString(array('required' => true),  array('required' =>__('error_name_required',null,'sys_account_group'))));
	}
	/*
	 * Type of group
	 */
	private function addType(){
		$types = array(
				'-1'=> __('option_select', null, 'table_list'),
				'0'	=> __('type_0', null, 'sys_account_group'),
				'1'	=> __('type_1', null, 'sys_account_group'),
		);
		$this->setWidget('type', new sfWidgetFormChoice(array('choices'=>$types,'expanded'=>false)));
		$this->setValidator('type', new sfValidatorChoice(array('choices'=>array('0','1'))));
	}
	
}
